package www.dashu.com.dao;

import www.dashu.com.dao.base.BaseDao;
import www.dashu.com.domain.SysUserApp;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SysUserAppDao extends BaseDao<SysUserApp,Long> {

    @Query(value = "select o from SysUserApp o where o.id =:id")
    List<SysUserApp> getSysUserAppById(@Param("id") Long id);

    @Modifying
    @Query(value = "delete from SysUserApp o where o.id = ?1")
    void deleteSysUserAppById(Long id);

    @Query(value = "select o from SysUserApp o where o.uId =:userId")
    List<SysUserApp> findUserAppsByUserId(@Param("userId") Long userId);

    @Modifying
    @Query(value = "delete from SysUserApp o where o.uId = :userId")
    void deleteUserAPpByUserId(@Param("userId") Long userId);
}